<template>
	<view class="fabu">
		<navbar :isback="false" title="广告发布"></navbar>
		
		<view class="">
			<view class="u-flex u-flex-y-center u-flex-between" style="padding: 30rpx 0;">
				<u-tabs :list="list4" lineWidth="118rpx" lineHeight='10rpx' lineColor="#0381FC" :activeStyle="{
				            color: '#1E1E1E',
				            fontWeight: 'bold',
				            transform: 'scale(1.15)'
				        }" :inactiveStyle="{
				            color: '#1E1E1E',
				            transform: 'scale(1)'
				        }" itemStyle="padding-left: 32rpx; padding-right: 32rpx; height: 50rpx;font-size:26rpx;">
				</u-tabs>
				<view class="u-flex u-flex-y-center" @click="to('/pages/tabbar/kefu',2)">
					<u-icon name="question-circle" size="40rpx" color="#1E1E1E"></u-icon>
					<view class="bz">
						帮助
					</view>
				</view>
			</view>
			<view class="con">
				<view class="con__box" @click="to('/pages/msg/create?title=其他信息&is_other=2')">
					<view class="u-flex u-flex-y-center">
						<u-icon size="80rpx" name="/static/fabu/icon.png"></u-icon>
						<view class="" style="margin-left: 20rpx;">
							发布其他信息
						</view>
					</view>
					<u-icon name="arrow-right" size="24rpx" color="#FFFFFF"></u-icon>
				</view>
			
			</view>
			<view class="list">
				<view class="list__item" v-for="(item, index) in list" :class='item.name.length>11?"u-grid-item1":""' :index="index" :key="index" @click="click(item)">
					<image :src="URL(item.image)" mode="" style="height: 58rpx;margin-top: 36rpx;" :style='{width:item.name.length>11?"240rpx":"58rpx"}'></image>
					<text class="grid-text" style="text-align: center;width: 70%;line-height: 36rpx;" :style="{width:item.name.length>11?'80%':'70%'}">{{item.name}}</text>
				</view>
			</view>
		</view>
		<u-popup mode="bottom" :show="show" round="30rpx" @close="show=false" closeOnClickOverlay>
			<view class="popbox">
				<view class="popbox__title">
					<view class="popbox__title__xing">
						*
					</view>
					发布房屋租售
					<view class="popbox__title__xing">
						*
					</view>
				</view>
				<view class="u-flex u-flex-y-center u-flex-between u-flex-wrap">
					<view class="popbox__item" v-for="(item,index) in poplist" :key="index" @click="to('/pages/msg/create?title='+item.name+'信息'+'&category_id='+item.id),show=false">
						<view class="popbox__item__dian">
							
						</view>
						{{item.name}}
					</view>
				</view>
			</view>
		</u-popup>
		<view class="kf">
			<button class="u-reset-button" open-type="contact">
				<image src="/static/xishi/kf.png" class="kficon" mode=""></image>
			</button>
		</view>
	</view>
</template>

<script>
	import home from '@/api/_home.js'
	export default {
		data() {
			return {
				list4: [{
					name: '发布类型'
				}],
				show: false,
				poplist:[],
				list: this.$store.state.categorylist,
				loading:true
			};
		},
		methods: {
			click(item) {
				// console.log(item.poplist.length)
				if (item.child.length > 0) {
					this.show = true
					this.poplist=item.child
				} else {
					this.to('/pages/msg/create?title='+(item.name+'信息')+'&category_id='+item.id)
				}
			},
			
		},
		onLoad() {
			
		},
		onShow() {
			
		}
	}
</script>

<style lang="scss">
	.con {
		padding: 0 32rpx;

		&__box {
			height: 135rpx;
			background: #0381FC;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 28rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 30rpx;
			color: #FFFFFF;
			line-height: 30rpx;
		}
	}

	.bz {
		font-family: PingFang SC;
		font-weight: bold;
		font-size: 26rpx;
		color: #1E1E1E;
		line-height: 26rpx;
		margin-left: 10rpx;
		padding-right: 32rpx;
	}

	.grid-text {
		font-family: PingFang SC;
		font-weight: bold;
		font-size: 24rpx;
		color: #0F0D0E;
		line-height: 24rpx;
		margin-top: 10rpx;
	}

	.fabu {
		padding-bottom: 150rpx;
		/* #ifdef MP */
		padding-bottom: 30rpx;
		/* #endif */
	}

	.popbox {
		background: #FCF9F9;
		border-radius: 30rpx;
		padding: 60rpx 60rpx 80rpx;
		&__title{
			width: 337rpx;
			height: 109rpx;
			background: #F1F4FB;
			border-radius: 30rpx;
			margin: 0 auto;
			display: flex;
			align-items: center;
			justify-content: center;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 30rpx;
			color: #302F2F;
			line-height: 30rpx;
			&__xing{
				color: #0481FC;
			}
		}
		&__item{
			width: 291rpx;
			height: 102rpx;
			background: #0481FC;
			border-radius: 30rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 30rpx;
			color: #FFFFFF;
			line-height: 30rpx;
			margin-top: 36rpx;
			&__dian{
				width: 10rpx;
				height: 10rpx;
				border-radius: 50%;
				border: 3rpx solid #FCF9F9;
				opacity: 0.6;
				margin-right: 7rpx;
			}
		}
	}
	.u-grid-item1{
		width: 43%!important;
	}
	.list{
		display: flex;
		justify-content: space-around;
		flex-wrap: wrap;
		&__item{
			display: flex;
			align-items: center;
			flex-direction: column;
			width: 20%;
		}
	}
</style>